$("#form-${model.modelL}-edit").validate({
	rules:{
#foreach($field in $fieldList)
#if($field.isPk != "Y")
#if(!$field.nullable)
		${field.field}:{
			required:true,
		},
#end
#end
#end
	},
	submitHandler:function(form){
		update();
	}
});

function update() {
#foreach($field in $fieldList) 
#if(${field.inputType}!="none")
#if(${field.inputType}=="select"&&${field.inputValueOne} !="")
	var ${field.field} = $("#${field.field} option:selected").val();
#elseif(${field.inputType}=="radio")
	var ${field.field} = $("input[name='${field.field}']").is(':checked') == true ? 0 : 1;
#elseif(${field.inputType}=="checkbox")
	var ${field.field} = $.getCheckeds("${field.field}");
#elseif(${field.inputType}=="htmleditor")
	var ${field.field} = ue_${field.field}.getContent();
#elseif(${field.inputType}=="textarea")
	var ${field.field} = $("#${field.field}").val();
#else
	var ${field.field} = $("input[name='${field.field}']").val();
#end
#end
#end  
	$.ajax({
		cache : true,
		type : "POST",
		url : ctx + "${model.modulePackage}/${model.modelL}/save",
		data : {
#foreach($field in $fieldList) 
#if(${field.inputType}!="none")
			"${field.field}": ${field.field},
#end
#end
		},
		async : false,
		error : function(request) {
			$.modalAlert("系统错误", modal_status.FAIL);
		},
		success : function(data) {
			if (data.code == 0) {
				parent.layer.msg("操作成功,正在刷新数据请稍后……",{icon:1,time: 500,shade: [0.1,'#fff']},function(){
					$.parentReload();
				});
			} else {
				$.modalAlert(data.msg, modal_status.FAIL);
			}

		}
	});
}

#foreach($field in $fieldList)
#if(${field.inputValueOne} == "sys_dept")
/*用户管理-修改-选择部门树*/
function selectDeptTree() {
	var deptId = $("#treeId").val();
	if(deptId == null || deptId == "")
		deptId=100;
    var url = ctx + "system/dept/selectDeptTree/" + deptId;
    layer_show("选择部门", url, '380', '380');
}
#end
#end